/**
 * Created by bilibili on 2018/5/9.
 */



$(document).ready(function() {
    var userId=getvl("userId");
    loadMyEssay(userId)
});

function loadMyEssay(userId) {
		$("#base_msg").html("");
		$.ajax({
			url: urlcore + "/api/userBasicMsg/selectOneByUserId?userId=" + userId,
			type: "get",
			async: 'false',
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
						var n = data.data;
						var base_msg =
							'<tr class="footable-even" style="display: table-row;">' +
							'<td class="footable-visible">' + n.marry + '</td>' +
							'<td class="footable-visible">' + n.study + '</td>' +
							'<td class="footable-visible">' + n.province +n.city+n.county+n.addressDetails+ '</td>' +
							'<td class="footable-visible">' + n.linkPersonNameOne + '</td>' +
							'<td class="footable-visible">' + n.linkPersonPhoneOne + '</td>' +
							'<td class="footable-visible">' + n.linkPersonRelationOne + '</td>' +
							'<td class="footable-visible">' + n.linkPersonNameTwo + '</td>' +
							'<td class="footable-visible">' + n.linkPersonPhoneTwo + '</td>' +
							'<td class="footable-visible">' + n.linkPersonRelationTwo + '</td>' +
							'<td class="footable-visible">' + n.gmtDatetime+'</td>' +	
							'</tr>';
						$('#base_msg').append(base_msg);
					if(data.code == 'OVERTIME') {
						var thisUrl = window.location.href;

						if(thisUrl.indexOf('login.html') <= -1) {
							top.window.location.href = "login.html";
						}

					} else {
						if(data.msg != '空数据') {
							//alert(data.msg)
						} else {
							$('#thiscount').text(0);
						}
					}
				}

			},
			error: function() {
				alert("error");
			}
		});



		$("#identity_msg").html("");
		$.ajax({
			url: urlcore + "/api/userIdentity/selectOneByUserId?userId=" + userId,
			type: "get",
			async: 'false',
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
						var n = data.data;
						var base_msg =
							'<tr class="footable-even" style="display: table-row;">' +
							'<td class="footable-visible"><img width="40px" height="40px" src="'+urlcore+n.identityBack+'"></td>'+
							'<td class="footable-visible"><img width="40px" height="40px" src="'+urlcore+n.identityFront+'"></td>'+
							'<td class="footable-visible"><img width="40px" height="40px" src="'+urlcore+n.faceUrl+'"></td>'+
							'<td class="footable-visible">' + n.identityNum + '</td>' +
							'<td class="footable-visible">' + n.gmtDatetime+'</td>' +	
							'</tr>';
						$('#identity_msg').append(base_msg);
						$('img').zoomify();
					if(data.code == 'OVERTIME') {
						var thisUrl = window.location.href;

						if(thisUrl.indexOf('login.html') <= -1) {
							top.window.location.href = "login.html";
						}

					} else {
						if(data.msg != '空数据') {
							//alert(data.msg)
						} else {
							$('#thiscount').text(0);
						}
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
		
		
		$("#bank_msg").html("");
		$.ajax({
			url: urlcore + "/api/userBank/selectOneByUserId?userId=" + userId,
			type: "get",
			async: 'false',
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
						var n = data.data;
						var base_msg =
							'<tr class="footable-even" style="display: table-row;">' +
							'<td class="footable-visible">' + n.bankcardno + '</td>' +
							'<td class="footable-visible">' + n.name+'</td>' +
							'<td class="footable-visible">' + n.bankPhone + '</td>' +
							'<td class="footable-visible">' + n.idcardno+'</td>' +	
							'<td class="footable-visible">' + n.gmtDatetime+'</td>' +	
							'</tr>';
						$('#bank_msg').append(base_msg);
					if(data.code == 'OVERTIME') {
						var thisUrl = window.location.href;

						if(thisUrl.indexOf('login.html') <= -1) {
							top.window.location.href = "login.html";
						}

					} else {
						if(data.msg != '空数据') {
							//alert(data.msg)
						} else {
							$('#thiscount').text(0);
						}
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
		
		
		$("#phone_msg").html("");
		$.ajax({
			url: urlcore + "/api/userPhone/selectOneByUserId?userId=" + userId,
			type: "get",
			async: 'false',
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
						var n = data.data;
						var phone_msg =
							'<tr class="footable-even" style="display: table-row;">' +
							'<td class="footable-visible">' + n.operatorName + '</td>' +
							'<td class="footable-visible">' + n.billFee+'</td>' +
							'<td class="footable-visible">' + n.netAge + '</td>' +
							'<td class="footable-visible">' + n.contactPhoneNum+'</td>' +	
							'<td class="footable-visible">' + n.listincontacttop10Num+'</td>' +
							'<td class="footable-visible">' + n.contactLimit+'</td>' +	
							'</tr>';
						$('#phone_msg').append(phone_msg);
					if(data.code == 'OVERTIME') {
						var thisUrl = window.location.href;

						if(thisUrl.indexOf('login.html') <= -1) {
							top.window.location.href = "login.html";
						}

					} else {
						if(data.msg != '空数据') {
							//alert(data.msg)
						} else {
							$('#thiscount').text(0);
						}
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
}





